// @ts-ignore
/* eslint-disable */
import request from '@/request'

/** 获取角色列表 GET /role/list */
export async function getRole(options?: { [key: string]: any }) {
  return request<API.BaseResponseListRoleVo>('/role/list', {
    method: 'GET',
    ...(options || {}),
  })
}

/** 新增/修改角色 POST /role/save */
export async function addRole(body: API.SaveRoleRequest, options?: { [key: string]: any }) {
  return request<API.BaseResponseBoolean>('/role/save', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}

/** 获取该角色所有用户 GET /role/user/list */
export async function getUsersByRoleId(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.getUsersByRoleIdParams,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseListUserVo>('/role/user/list', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  })
}

/** 角色添加用户 POST /role/user/save */
export async function addUserRole(body: API.SaveUserRoleRequest, options?: { [key: string]: any }) {
  return request<API.BaseResponseBoolean>('/role/user/save', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}
